# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-beetle-pcfx
pkgver=0.9.36.36
_realname=Nexus
pkgrel=0
pkgdesc="Beetle-pcfx for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.beetle-pcfx"
arch="x86_64 aarch64 armv7" # kodi is available only on these architectures
license="GPL-2.0-only"
makedepends="cmake kodi-dev samurai"
depends="kodi-game-libretro libretro-beetle-pcfx"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.beetle-pcfx/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.beetle-pcfx-$pkgver-$_realname"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pcfx/game.libretro.beetle-pcfx.so
	ln -s /usr/lib/libretro/mednafen_pcfx_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pcfx/game.libretro.beetle-pcfx.so
}

sha512sums="
a459a02fd9934d4ea81b87dfc160caf52b77c6e4001d7f08761f465b2b427772f251bf00377e7588681ef737e9f90963daaebe1791379c8927930e187234969c  kodi-game-libretro-beetle-pcfx-0.9.36.36-Nexus.tar.gz
"
